<!DOCTYPE html>
<html lang="en-US">
  <head>
    <link href="/assets/index.css" rel="stylesheet" type="text/css" />
    <script crossorigin="anonymous" src="/test-harness.js"></script>
    <script crossorigin="anonymous" src="/test-page-object.js"></script>
    <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
  </head>
  <body>
    <main id="webchat"></main>
    <script>
      run(async function () {
        WebChat.renderWebChat(
          {
            directLine: testHelpers.createDirectLineWithTranscript([
              {
                from: {
                  id: 'bot',
                  role: 'bot'
                },
                suggestedActions: {
                  actions: [
                    {
                      title: 'What can I say?',
                      type: 'imBack'
                    },
                    {
                      title: 'What is the weather?',
                      type: 'imBack'
                    }
                  ]
                },
                textFormat: 'markdown',
                timestamp: new Date(2000, 0, 1, 12, 34, 56, 789).toISOString(),
                type: 'message'
              }
            ]),
            store: testHelpers.createStore(),
            styleOptions: {
              suggestedActionLayout: 'carousel'
            }
          },
          document.getElementById('webchat')
        );

        await pageConditions.uiConnected();
        await pageConditions.suggestedActionsShown();

        // THEN: Suggested actions container in carousel layout should be of `role="toolbar"` with `aria-orientation="horizontal"`
        const suggestedActions = document.querySelector('.webchat__suggested-actions');

        expect(suggestedActions.getAttribute('role')).toBe('toolbar');
        expect(suggestedActions.getAttribute('aria-orientation')).toBe('horizontal');
      });
    </script>
  </body>
</html>
